//
//  CmtSecAttenComment.m
//  Products_B
//
//  Created by lanou on 16/5/30.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "CmtSecAttenComment.h"

@implementation CmtSecAttenComment
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{

    if ([key isEqualToString:@"id"]) {
        __id = value;
    }
    if ([key isEqualToString:@"parents"]) {
        
        for (NSDictionary *dic in value) {
            CmtSecAttenComment *model = [[CmtSecAttenComment alloc]init];
            [model setValuesForKeysWithDictionary:dic];
            [self.parents addObject:model];
            
            _parents_user_id = dic[@"user_id"];
            _parents_nick = dic[@"nick"];
            _parentid = dic[@"id"];
            _parent_content = dic[@"content"];
            _parent_par_id = dic[@"parent_id"];
            
        }
    }

}

+(NSMutableArray *)setModelWithJsDic:(NSDictionary *)jsDic{

    NSMutableArray *modelArray = [NSMutableArray arrayWithCapacity:10];
    
    NSDictionary *dataDic = jsDic[@"data"];
//    NSLog(@"%@",jsDic);
   
//    NSLog(@"---------------%@",[jsDic[@"data"][@"data"] class]);
//    NSLog(@"%d",[jsDic[@"data"][@"data"] isKindOfClass:[NSString class]]);
   
    if ([jsDic[@"data"][@"data"] isEqual:[NSNull null]]) {
        return nil;
        }
    NSArray *dataArr = jsDic[@"data"][@"data"];
    for (NSDictionary *dic in dataArr) {
        CmtSecAttenComment *model = [[CmtSecAttenComment alloc]init];
        [model setValuesForKeysWithDictionary:dataDic];
        [model setValuesForKeysWithDictionary:dic];
        [modelArray addObject:model];
    }
    
    
    return modelArray;
}



@end
